from abc import ABC, abstractmethod
from datetime import datetime
from typing import Dict, List
import pandas as pd

class BaseFactor(ABC):
    """因子计算基类"""
    
    def __init__(self, lookback: int = 30):
        self.lookback = lookback  # 计算窗口
    
    @abstractmethod
    async def calculate(self, symbols: List[str], end_date: datetime) -> pd.DataFrame:
        """核心计算方法"""
        pass
    
    @property
    @abstractmethod
    def version(self) -> str:
        """因子版本标识"""
        pass
    
    def validate_input(self, data: pd.DataFrame) -> bool:
        """输入数据校验"""
        required_cols = {'open', 'high', 'low', 'close', 'volume'}
        return required_cols.issubset(data.columns)

class TechnicalIndicator(BaseFactor):
    """技术指标因子基类"""
    pass

class FundamentalFactor(BaseFactor):
    """基本面因子基类"""
    pass

class PriceVolumeFactor(BaseFactor):
    """量价特征因子基类"""
    pass